<!DOCTYPE html>
<html lang="en">
 <head>
  <meta charset="UTF-8">
  <title>Document</title>
  <style>
  html,body{    /*注意:必须加上此CSS样式，JS才能获取到clientHeight*/
    width:100%;
    height:100%;
  }
  </style>
  <script>
    function winChange(){
        winWidth = document.body.clientWidth;
        winHeight = document.body.clientHeight;
        alert('窗体大小发生改变,宽:'+winWidth+",高:"+winHeight);
    }
  </script>
 </head>
 <body onresize="winChange()">
 </body>
</html>
